VtComboBox
Create a ComboBox
Syntax
VtComboBox object_name [options]
Description
Creates a ComboBox widget. Returns the widget name.
Options
- -callback cmd (C)
- Specifies the callback cmd. This is called when
an item is selected from the ComboBox droplist in either of the
following ways:
- The value changes and the widget loses focus.
- The <Enter> key is pressed in the ComboBox text field.
Additional callback keys
- value
- the contents of the ComboBox's text field.
- -columns integer (CS)
- Specifies the width of the ComboBox. The width of the ComboBox
is integer * MaxCharwidth, where MaxCharwidth is the width
of the largest character in the current character set.
- -dropListCallback cmd (C)
- Specifies that the callback cmdis called when the
ComboBox's droplist is opened.
Additional callback keys
- value
- value in text field of the ComboBox
- -itemList list (CSG)
- Specifies the contents of the ComboBox. list is a list of items to use as the contents.
- -readOnly (C)
- Specifies that editing of the ComboBox text field is disabled.
- -value string (CS)
- Specifies the default contents of the ComboBox's text
field. Note that string must be present in the contents of
the ComboBox as specified by the -itemList option.
- -valueChangedCallback cmd (CS)
- Specifies that the callback cmd is called after text
is deleted from or inserted into the widget.
Additional callback keys
- value
- the contents of the ComboBox's text field.
Example
The following example creates a ComboBox containing four items,
and specifies a default selection.
set app [VtOpen demo]
set form [VtFormDialog $app.form \
-title "VtComboBox Demo"]
VtComboBox $form.checkbox \
-value Apples \
-itemList {Oranges Apples Bananas Kumquats}
VtShow $form
VtMainLoop
This code produces the following:
See also: